﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace SLBehaviourSystem
{
    [ActionComponent]
    public class MoveComponent : BehaviourComponent
    {

        protected float Speed=1;
        protected float DistanceOffset=1.5f;

        protected override void OnBindNode()
        {
            base.OnBindNode();
            Speed = node.BehaviourData.GetFloat("Speed");
            DistanceOffset = node.BehaviourData.GetFloat("DistanceOffset");

        }

        protected virtual void Move(float speed, float distanceOffset)
        {
            bool isEnd = true;
            if (isEnd)
            {
                enabled = false;
            }
        }

        public override void ExcuteAsync(Action<BehaviourNodeState> onExcuteCompleted)
        {
            base.ExcuteAsync(onExcuteCompleted);
        }

        private void Update()
        {
            Move(Speed, DistanceOffset);
        }

        public override void Reset()
        {
            base.Reset();
            enabled = false;
        }
    }
}
